from django.db import models


class nmap_host(models.Model):

    host_name = models.CharField(verbose_name="扫描主机名称", max_length=30)
    host_ip = models.GenericIPAddressField(
        verbose_name="扫描主机IP", blank=True, null=True)
    host_up = models.CharField(verbose_name="扫描主机状态", max_length=30)
    host_protocol = models.CharField(
        verbose_name="扫描主机协议", max_length=30, default="tcp")
    host_port = models.CharField(verbose_name="扫描主机端口", max_length=30)
    host_state = models.CharField(verbose_name="扫描主机端口状态", max_length=30)
    create_date = models.DateTimeField(auto_now_add=True, verbose_name="创建时间")
    update_date = models.DateTimeField(auto_now=True, verbose_name="更新时间")

    class Meta:
        db_table = "nmap_host"
        managed = True
        verbose_name = ("nmap_host")
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name
    # def get_absolute_url(self):
    #   from django.urls import reverse
    #   return reverse("_detail", kwargs={"pk": self.pk})
